#include <stdio.h>
#include <string.h>
#include <stdlib.h>

static long string_hash(register unsigned char *p, int size) {
    register int len;
    register long x;

    len = size;
    x = *p << 7;
    while (--len >= 0) {
        x = (1000003*x) ^ *p++;
    }

    x ^= size;

    return x;
}


int main(int argc, char **argv) {
    unsigned char ch;
    unsigned long i = 0,
                  x = 0,
                  n = 0xFFFFFFFF,
                  N = 1521914525L;

    for (; i < n; i++) {
        x = string_hash((unsigned char *)&i, 4);
        if (x == N) {
            printf("%4lu hash: %10lu\n", i, x);
            return 0;
        }
    }

    return 0;
}


